import React, { useContext } from "react";
import { Observer } from "mobx-react";
// import { Route, Switch, Redirect } from "react-router-dom";

// import { Context } from "./index";

import { Context } from "./store/MyContext";
import LeftMenu from "./component/leftmenu/LeftMenu";

import Login from "../src/pages/login/Login";

import "./App.css";

function App() {
  const context = useContext(Context);

  return (
    <div className='App'>
      <Observer>
        {() => {
          if (context.user[0]) {
            return <LeftMenu />;
          } else {
            return <Login />;
          }
        }}
      </Observer>
    </div>
  );
}

export default App;
